package com.example.czxyindex.web;

import com.example.czxyindex.web.remote.ITopicAction;
import com.yc.czxy.bean.Topic;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
public class schoolAction {

    @Resource
    ITopicAction iTopicAction;

    @GetMapping({"news","news.html"})
    @ResponseBody
    public ModelAndView news(@RequestParam Map<String,Object> map) {
        List<Topic> topics = iTopicAction.local(map);
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject(topics);
        return modelAndView;
    }
}
